﻿using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Data.SqlClient;
using Pheonix.CodeLibrary.Data;


/// <summary>
/// Summary description for ProductTopCategory
/// </summary>

namespace Pheonix.Fashionzoomer.CustomEntity
{
    [System.ComponentModel.DataObject]
    public sealed class ProductTopCategory : SqlServerDAO
    {
        private string _categoryName;
        private int _categoryValue;

        public string CategoryName
        {
            get { return _categoryName; }
            set { _categoryName = value; }
        }

        public int CategoryValue
        {
            get { return _categoryValue; }
            set { _categoryValue = value; }
        }

        public ProductTopCategory() { }

        public ProductTopCategory(string categoryName, int categoryValue)
        {
            this._categoryName = categoryName;
            this._categoryValue = categoryValue;
        }

        public List<ProductTopCategory> GetTopProductCategoryList()
        {
            List<ProductTopCategory> topCategoryList = new List<ProductTopCategory>();

            SqlCommand sqlCmd = new SqlCommand();

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SPR_CUSTOM_GETTOPPRODUCTCATEGORYLIST);

            DataTable table =  GetTableData(sqlCmd);

            foreach (DataRow row in table.Rows)
            {
                topCategoryList.Add(new ProductTopCategory(row["category_name"].ToString(),Convert.ToInt32(row["id"])));
            }

            return topCategoryList;
        }

        private const string SPR_CUSTOM_GETTOPPRODUCTCATEGORYLIST = "spr_Custom_GetTopProductCategoryList";
    }
}